package com.wwl.cms.utils.designModeTest.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/7 19:00
 * @description:
 */
public class College extends OrganizationComponent {
    List<OrganizationComponent> organizationComponents = new ArrayList<OrganizationComponent>();
    //构造器
    public College(String name,String des){
        super(name,des);
    }
    @Override
    protected void add(OrganizationComponent organizationComponent){
        organizationComponents.add(organizationComponent);
    }
    @Override
    protected void remove(OrganizationComponent organizationComponent){
        organizationComponents.remove(organizationComponent);
    }
    @Override
    public String getName(){
        return super.getName();
    }
    @Override
    public String getDes(){
        return super.getDes();
    }
    @Override
    protected void print(){
        System.out.println("---------"+getName()+"--------------");
        for (OrganizationComponent organizationComponent: organizationComponents){
            organizationComponent.print();
        }
    }
}
